{extend name="template/base" /}
{block name="content"}
<div class="page-container">
    <form class="form form-horizontal" id="form" method="post" action="{:\\think\\Request::instance()->baseUrl()}">
        <input type="hidden" name="id" value="{:isset($vo)?$vo.id:''}">
        <div class="row cl">
            <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>分类：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <div class="select-box">
                    <select name="type_id" class="select" datatype="*" nullmsg="请选择分类">
                        <option value='0'>- 分类 -</option>
                        {foreach $type as $type}
                        <option value="{$type.id}" {if(isset($vo) && $type['id'] == $vo['type_id'])} selected{/if} >{$type.name}</option>
                        {if(isset($type['_child']) && is_array($type['_child']))}
                        	{foreach $type['_child'] as $_child}
                        		<option value="{$_child.id}" {if(isset($vo) && $_child['id'] == $vo['type_id'])} selected{/if} >&nbsp;&nbsp;&nbsp;&nbsp;{$_child.name}</option>
                        	{/foreach}
                        {/if}
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="col-xs-2 col-sm-2"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>标题：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" placeholder="标题" name="title" value="{$vo.title ?? ''}" >
            </div>
            <div class="col-xs-2 col-sm-2"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-2 col-sm-2">状态：</label>
            <div class="formControls col-xs-8 col-sm-8 skin-minimal">
                <div class="radio-box">
                    <input type="radio" name="status" id="status-0" value="0">
                    <label for="status-0">禁用</label>
                </div>
                <div class="radio-box">
                    <input type="radio" name="status" id="status-1" value="1">
                    <label for="status-1">显示</label>
                </div>
            </div>
            <div class="col-xs-2 col-sm-2"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-2 col-sm-2">内容：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <textarea name="content" id="content">{$vo.content ?? ''}</textarea>
            </div>
            <div class="col-xs-2 col-sm-2"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-2 col-sm-2">排序：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="number" class="input-text" placeholder="排序" name="sort" value="{$vo.sort ?? '0'}" >
            </div>
            <div class="col-xs-2 col-sm-2"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-2 col-sm-2">URL：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" placeholder="URL" name="url" value="{$vo.url ?? ''}" >
            </div>
            <div class="col-xs-2 col-sm-2"></div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <button type="submit" class="btn btn-primary radius">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <button type="button" class="btn btn-default radius ml-20" onClick="layer_close();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script>
<script>window.UEDITOR_HOME_URL = '__LIB__/ueditor/1.4.3/'</script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
<script>
                    $(function () {
                        $("[name='status'][value='{$vo.status ?? '1'}']").attr("checked", true);
                        $("[name='type_id']").find("[value='{$vo.type_id ?? ''}']").attr("selected", true);

                        $('.skin-minimal input').iCheck({
                            checkboxClass: 'icheckbox-blue',
                            radioClass: 'iradio-blue',
                            increaseArea: '20%'
                        });

                        $("#form").Validform({
                            tiptype: 2,
                            ajaxPost: true,
                            showAllError: true,
                            callback: function (ret) {
                                ajax_progress(ret);
                            }
                        });

                        var ue = UE.getEditor('content', {
                            toolbars: [
                                ['fullscreen', 'source', 'undo', 'redo', 'bold']
                            ],
                            autoHeightEnabled: true,
                            autoFloatEnabled: true,
                            initialFrameHeight:150,
                            maximumWords:10000
                        });
                    })
</script>
{/block}